package com.chushouya.manager.constants;


import com.general.framework.core.enums.IEnum;

import java.util.Objects;

public enum ClerkUserTypeEnum implements IEnum<Integer> {

    // 业务员
    CLERK(1, "业务员"),
    // 加盟商 业务员加盟商类型 PartnerTypeEnum 对应
    FRANCHISEE(2, "加盟商"),
    //客服
    CUSTOMER_SERVICE(3, "客服"),
    CMCC_EMPLOYEE(4, "移动店员"),

    OFFLINE_STORE(5, "线下门店店员")
    ;

    private Integer value;
    private String desc;

    ClerkUserTypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Integer value() {
        return this.value;
    }

    @Override
    public String named() {
        return this.desc;
    }

    public static String getDesc(Integer value) {
        for (ClerkUserTypeEnum thisEnum : ClerkUserTypeEnum.values()) {
            if (Objects.equals(thisEnum.value, value)) {
                return thisEnum.desc;
            }
        }
        return "";
    }

    /**
     * 传统意义上的业务员
     * 加盟商业务员/平台业务员
     */
    public static boolean isGeneralClerk(Integer clerkUserType) {
        return Objects.equals(ClerkUserTypeEnum.CLERK.value(), clerkUserType) ||
                Objects.equals(ClerkUserTypeEnum.FRANCHISEE.value(), clerkUserType);
    }
}
